Skip to content

[Runtime] Implemented Datatype.itemsize()#16880

Merged
tqchen merged 4 commits intoapache:mainfrom
vinx13:feat/itemsize
Apr 14, 2024
Merged

[Runtime] Implemented Datatype.itemsize()#16880
tqchen merged 4 commits intoapache:mainfrom
vinx13:feat/itemsize

Conversation

@vinx13
Copy link
Copy Markdown
Member

@vinx13 vinx13 commented Apr 13, 2024

Added a utility method itemsize to DataType, this is similar to numpy.array.itemsize

cc @tqchen

@github-actions github-actions Bot requested a review from tqchen April 13, 2024 03:21
Comment thread python/tvm/_ffi/runtime_ctypes.py Outdated
lanes_as_int = ctypes.c_int16(self.lanes).value
if lanes_as_int < 0:
raise ValueError("Cannot determine itemsize for scalable vector types")
return self.bits * self.lanes // 8
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(self.bits * self.lanes + 7) // 8

@tqchen tqchen merged commit 64911ab into apache:main Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants